using System;
using System.Collections;
using System.Collections.Generic;

namespace ECommerce.DAL
{
    /// <summary>
    /// This is the helper collection class, that holds generic type data.
    /// This type will be used to manipulate generic class.
    /// Class architecture designed by: Mohammad Ashraful Alam [ ashraf@desme.com ]
    /// </summary>
    /// <typeparam name="GenericType"></typeparam>
    [Serializable]
    public class CustomCollection<GenericType> : CollectionBase, IList<GenericType>
    {
        /// <summary>
        /// Adds an object to the collection.
        /// </summary>
        /// <param name="GenericObject"></param>
        public void Add(GenericType item)
        {
            InnerList.Add(item);
        }

        /// <summary>
        /// Removes an object from the collection.
        /// </summary>
        /// <param name="index"></param>
        public void Remove(int index)
        {
            InnerList.RemoveAt(index);
        }

        /// <summary>
        /// Gets and sets the appropriate object in the specified index.
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public GenericType this[int index]
        {
            get { return ((GenericType)List[index]); }
            set { List[index] = value; }
        }


        #region IList<GenericType> Members

        public int IndexOf(GenericType item)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void Insert(int index, GenericType item)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion

        #region ICollection<GenericType> Members


        public bool Contains(GenericType item)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void CopyTo(GenericType[] array, int arrayIndex)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public bool IsReadOnly
        {
            get { throw new Exception("The method or operation is not implemented."); }
        }

        public bool Remove(GenericType item)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion

        #region IEnumerable<GenericType> Members

        public new IEnumerator<GenericType> GetEnumerator()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion

    }//end of GenericCollection<GenericType>

}
